Skip to main content

All Questions

Tagged with
0votes
1answer
215views

Delete all folders in specified path that do not have word "edit" in them?

I'm trying to set up a simple script that would clean up my working folder. The working folder is structured like that: Project 1 Project 1 [edited] Project 2 Project 2 [edited] Project 3 Project 3 [...
Den's user avatar
-2votes
1answer
178views

Removing certain files in a series of subdirectories

I have a directory that has several subdirectories in it. Each subdirectory has several files in it. I want to delete all the files in the subdirectories except the .pdf ones. And leave the ...
Jay's user avatar
-1votes
2answers
831views

bash: Deleting directories not containing given strings

How can I delete directories using the bash that do not contain directories named wav or mp3? I use macOS Sierra. find . -type d \! -exec test -e '{}/wav' \; -print finds the directories not ...
typokurz's user avatar
1vote
0answers
288views

Find directory containing file; execute command in that dir; then delete files

I want to find all directories (recursively) which contain .cue files, execute a command in that directory, then delete all files in that directory with the same prefix as the .cue file. find . -name ...
emacsomancer's user avatar
0votes
2answers
1kviews

Delete recursive subfolders with find

I need to delete recursive subfolders in a single line. For one subfolder: find folder -name "subfolder" -exec rm -r "{}" \; or find folder -name "subfolder" -type d -...
BrianC's user avatar
1vote
2answers
622views

Use output from find command to then remove a specific directory

When i run this find command: find /html/car_images/inventory/ -type f -iname \*.jpg -mtime -4 i get output like this: /html/car_images/inventory/16031/16031_06.jpg /html/car_images/inventory/16117/...
James Gaul's user avatar
1vote
4answers
5kviews

How do I delete file by filename that are set as dates?

I want to delete file not by date access or created, but by filename. The filenames will be dates and I want to have a cronjob run once a week that will purge filename dates older than 7 days. I could ...
CP24eva's user avatar
13votes
2answers
15kviews

Remove all files recursively without deleting directories

I want to "clean out" all of the files a directory including all files in subdirectories but I want to leave the subdirectories in place. My understanding of rm -r is that it will also delete the ...
Scott Wilton's user avatar

close